/*
 * @Author: your name
 * @Date: 2022-04-11 12:54:50
 * @LastEditTime: 2022-04-17 23:35:27
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /vue/src/router/router.ts
 */
import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'

const routes: RouteRecordRaw[] = [
    {
        path: '/',
        name: 'Login',
        component: () => import('@/pages/Login/Login.vue'), // 注意这里要带上 文件后缀.vue
    },
    {
        path: '/main',
        name: 'Main',
        component: () => import('@/pages/Main/Main.vue'),
        // children: [],//子组件
    },

]

const router = createRouter({
    history: createWebHistory(),
    routes,
})
//路由导航守卫
// router.beforeEach((to, from, next) => {
//     let isAuthenticated=false
//     if (to.name !== 'Login' && !isAuthenticated) next({name: 'Login'})
//     else next()
// })
export default router
